/*
 * File:   debug.h
 * Author: serena
 *
 * Created on 18 June 2013, 05:59
 */

#ifndef DEBUG_H
#define	DEBUG_H

#ifndef DEBUG_MODE
#define NDEBUG
#endif

#ifdef  DEBUG_MODE

/**
 *  Maschera di bit per i livelli di debug
 *
 * Questa maschera abilita o disabilita i livelli di debug a seconda del
 * valore che assume:
 * 0   NESSUN LIVELLO;
 * 1   TRACE;
 * 2               GD1;
 * 3   TRACE       GD1;
 * 4                       GD2;
 * 5   TRACE               GD2;
 * 6               GD1     GD2;
 * 7   TRACE       GD1     GD2;
 */
extern int MASK;

#define DBG(a, b)       {if ((a) & MASK) {b; }}
#define D1(a)           DBG(1, std::cout<<"D: "<<a<<endl)
#define GD1(a)          DBG(2, std::cout<<"G1 ";{a;})
#define GD2(a)          DBG(4, std::cout<<"G2 ";{a;})
#else
#define DBG(a, b)
#define D1(a)
#define GD1(a)
#define GD2(a)
#endif


#endif	/* DEBUG_H */

